package com.example.demo;

import java.time.LocalDate;
import java.time.LocalDateTime;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * RabbitMq 生产者
 * @author binbin.zhang
 *
 */
@Component
public class Sender {

	@Autowired
	private AmqpTemplate rabbitTemplate;
	
	public void send() {
		String context="hello RabbitMq"+LocalDateTime.now();
		System.out.println("Sender:"+context);
		this.rabbitTemplate.convertAndSend("hello",context);
	}
}
